/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dao.ibatis;

import com.ibatis.sqlmap.client.SqlMapClient;
import model.dao.CedulaVotacionDao;
import model.bean.CedulaVotacion;
import java.util.List;
import java.util.Map;
import model.common.ibatis.IbatisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

/**
 * @Archivo CedulaVotacionDaoIbatis.java
 * @Fecha                @Autor   @Cambios
 * 21/01/2011 04:11:51 PM       moshiro
 */
@Repository
public class CedulaVotacionDaoIbatis extends SqlMapClientDaoSupport implements CedulaVotacionDao {

    @Autowired
    public CedulaVotacionDaoIbatis(SqlMapClient arg) {
        setSqlMapClient(arg);
    }

    @Override
    public Long agregarCedulaVotacion(CedulaVotacion cedulaVotacion) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(cedulaVotacion);
        return ((Long) getSqlMapClientTemplate().queryForObject("agregarCedulaVotacion", parameterMap)).longValue();
    }

    @Override
    public Integer modificarCedulaVotacion(CedulaVotacion cedulaVotacion) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(cedulaVotacion);
        return ((Integer) getSqlMapClientTemplate().update("modificarCedulaVotacion", parameterMap));
    }

    @Override
    public Integer eliminarCedulaVotacion(Long codigo) throws DataAccessException {
        CedulaVotacion cedulaVotacion = new CedulaVotacion();
        cedulaVotacion.setCodigo(codigo);
        return ((Integer) getSqlMapClientTemplate().delete("eliminarCedulaVotacion", cedulaVotacion));
    }

    @Override
    public List<CedulaVotacion> listarCedulaVotacion(CedulaVotacion cedulaVotacion) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(cedulaVotacion);
        return getSqlMapClientTemplate().queryForList("listarCedulaVotacion", parameterMap);
    }
}
